/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.provafinal.bean;

import java.io.Serializable;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletRequest;

/**
 *
 * @author Lcs
 */
public class AbstractBean implements Serializable {

    protected void addMessageToRequest(String message) {
        HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
        request.setAttribute("msg", message);
    }

    protected String redirect(String outcome) {
        return outcome + "?faces-redirect=true";
    }
    
    public void messagens(String msg){
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(msg));
    }
}
